.TH "KMeansModel" "" "" "" ""
.SH NAME
.PP
KMeansModel \- A data structure used in modeling the output of the
frovedis server side kmeans clustering algorithm at client spark side.
.SH SYNOPSIS
.PP
import com.nec.frovedis.mllib.clustering.KMeansModel
.SS Public Member Functions
.PP
Int predict (Vector data)
.PD 0
.P
.PD
\f[C]RDD[Int]\f[] predict (\f[C]RDD[Vector]\f[] data)
.PD 0
.P
.PD
Int getK()
.PD 0
.P
.PD
Unit save(String path)
.PD 0
.P
.PD
Unit save(SparkContext sc, String path)
.PD 0
.P
.PD
KMeansModel KMeansModel.load(String path)
.PD 0
.P
.PD
KMeansModel KMeansModel.load(SparkContext sc, String path)
.PD 0
.P
.PD
Unit debug_print()
.PD 0
.P
.PD
Unit release()
.SH DESCRIPTION
.PP
KMeansModel models the output of the frovedis kmeans clustering
algorithm.
.PP
Note that the actual model with centroid information is created at
frovedis server side only.
Spark side KMeansModel contains a unique ID associated with the frovedis
server side model, along with some generic information like k value etc.
It simply works like a pointer to the in\-memory model at frovedis
server.
.PP
Any operations, like prediction etc.
on a KMeansModel makes a request to the frovedis server along with the
unique model ID and the actual job is served by the frovedis server.
For functions which returns some output, the result is sent back from
frovedis server to the spark client.
.SS Pubic Member Function Documentation
.SS Int predict (Vector data)
.PP
This function can be used when prediction is to be made on the trained
model for a single sample.
It returns with the predicted value from the frovedis server.
.SS \f[C]RDD[Int]\f[] predict (\f[C]RDD[Vector]\f[] data)
.PP
This function can be used when prediction is to be made on the trained
model for more than one samples distributed among spark workers.
.PP
It is performed by all the worker nodes in parallel and on success the
function returns a \f[C]RDD[Int]\f[] object containing the distributed
predicted values at worker nodes.
.SS Int getK()
.PP
It returns the number of clusters in the target model.
.SS KMeansModel KMeansModel.load(String path)
.PP
This static function is used to load the target model with data in given
filename stored at frovedis server side at specified location (filename
with relative/absolute path) as little\-endian binary data.
On success, it returns the loaded model.
.SS KMeansModel KMeansModel.load(SparkContext sc, String path)
.PP
This is Spark like static API provided for compatibility with spark
code.
But the "sc" parameter is simply ignored in this case and internally it
calls the above load() method as "KMeansModel.load(path)".
.SS Unit save(String path)
.PP
This function is used to save the target model with given filename.
Note that the target model is saved at frovedis server side at specified
location (filename with relative/absolute path) as little\-endian binary
data.
.SS Unit save(SparkContext sc, String path)
.PP
This is Spark like API provided for compatibility with spark code.
But the "sc" parameter is simply ignored in this case and internally it
calls the above save() method as "save(path)".
.SS Unit debug_print()
.PP
It prints the contents of the server side model on the server side user
terminal.
It is mainly useful for debugging purpose.
.SS Unit release()
.PP
This function can be used to release the existing in\-memory model at
frovedis server side.
